{# Render User Side Bar #}

{% set user=entity %}

<ul id="sidebar_list" class='nav nav-list'>

</ul>



<script>

    $(document).ready(function () {
        page_of('{{ user.name }}',
                '{{ user.login }}',
                "{%- if user.thumbnail -%}/{{ user.thumbnail.full_path }}{%- else -%}{{ request.static_url("stalker_pyramid:static/stalker/images/Placeholder_0.png")}}{%- endif -%}",
                '/users/{{ user.id }}/update/dialog')

        menu_of(
            'Dashboard',
            "{%- if request.current_route_path() == request.route_path('view_user', id=user.id) -%}'active',{%- else -%},{%- endif -%}",
            '{{ request.route_url('view_user', id=user.id) }}',
            get_icon('dashboard'),
            ''
        );

        menu_of(
            'Responsible of',
            "{%- if request.current_route_path() == request.route_path('list_user_tasks_responsible_of', id=user.id) -%}'active',{%- else -%},{%- endif -%}",
            '{{ request.route_url('list_user_tasks_responsible_of', id=user.id) }}',
            get_icon('task'),
            ''
        );

        menu_of(
            'Tickets',
            "{%- if request.current_route_path() == request.route_path('list_entity_tickets', id=user.id) -%}'active',{%- else -%},{%- endif -%}",
            '{{ request.route_url('list_entity_tickets', id=user.id) }}',
            get_icon('ticket'),
            '{{ user.open_tickets | count }}'
        );

        $.getJSON('/users/{{ user.id }}/reviews/count/').then(function (data) {
            menu_of(
                'Reviews',
                "{%- if request.current_route_path() == request.route_path('list_user_reviews', id=user.id) -%}'active',{%- else -%},{%- endif -%}",
                '{{ request.route_url('list_user_reviews', id=user.id) }}',
                get_icon('review'),
                data
            );
        });

        $.getJSON('/users/{{ entity.id }}/tasks/count/').then(function (data) {
            menu_of(
                'Tasks',
                "{%- if request.current_route_path() == request.route_path('list_entity_tasks', id=user.id) -%}'active',{%- else -%},{%- endif -%}",
                '{{ request.route_url('list_entity_tasks', id=user.id) }}',
                get_icon('task'),
                data
            );
        });

        $.getJSON('/users/{{ entity.id }}/vacations/count/').then(function (data) {
            $('#Vacations_count').text(data);
            menu_of('Vacations',
                "{%- if request.current_route_path() == request.route_path('list_entity_vacations', id=user.id) -%}'active',{%- else -%},{%- endif -%}",
                '{{ request.route_url('list_entity_vacations', id=user.id) }}',
                get_icon('vacation'),
                data
            );
        });

        submenu_of('{{ user.id }}','Project')

        submenu_of('{{ user.id }}','Department')

        submenu_of('{{ user.id }}','Group')

    });
</script>



